package main

import "fmt"

type PayI interface {
	DoPay()
}

type BankPay struct {
}

func (p *BankPay) DoPay() {
	fmt.Println("银行支付")
}

func Pay(pay PayI) {
	pay.DoPay()
}

type AliPay struct {
}

func (p *AliPay) DoAliPay() {
	fmt.Println("支付宝支付")
}

type PayAdapter struct {
	*AliPay
}

func (p *PayAdapter) DoPay() {
	p.DoAliPay()
}

func main() {
	Pay(&BankPay{})
	Pay(&PayAdapter{&AliPay{}})
}
